package edu.pku.sei.pgie.ui.preferences;

import java.util.ResourceBundle;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

import edu.pku.sei.pgie.Activator;

/**
 * Class used to initialize default preference values.
 */
public class PreferenceInitializer extends AbstractPreferenceInitializer {

	/*
     * (non-Javadoc)
     *
     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
     */
	public void initializeDefaultPreferences() {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		ResourceBundle bundle = ResourceBundle.getBundle("database");
		String driver = bundle.getString("database.driver");
		String url = bundle.getString("database.url");
		String user = bundle.getString("database.user");
		String password = bundle.getString("database.password");
		store
				.setDefault(PreferenceConstants.DATABASE_DRIVER_PREFERENCE,
						driver);
		store.setDefault(PreferenceConstants.DATABASE_URL_PREFERENCE, url);
		store.setDefault(PreferenceConstants.DATABASE_USER_PRERFERENCE, user);
		store.setDefault(PreferenceConstants.DATABASE_PASSWORD_PREFERENCE,
				password);
		store.setDefault(PreferenceConstants.ENABLE_OVERRIDE_ANALYZE, false);
		store.setDefault(PreferenceConstants.OUTPUT_FORMAT, "database");
                store.setDefault(PreferenceConstants.ENABLE_METHOD_ANALYZE, false);
	}

}
